package com.alpha.tables;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;


/**
 * The persistent class for the message database table.
 * 
 */
@Entity
@Table(name="message")
public class Message implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private MessagePK id;

	private String content;

	private int idconv;

    @Temporal( TemporalType.TIMESTAMP)
	@Column(name="send_time")
	private Date sendTime;

	//bi-directional many-to-one association to Conversation
    @ManyToOne
	@JoinColumns({
		@JoinColumn(name="conversation_called_idemployee", referencedColumnName="called_idemployee"),
		@JoinColumn(name="conversation_caller_idemployee", referencedColumnName="caller_idemployee"),
		@JoinColumn(name="conversation_idconversation", referencedColumnName="idconversation")
		})
	private Conversation conversation;

    public Message() {
    }

	public MessagePK getId() {
		return this.id;
	}

	public void setId(MessagePK id) {
		this.id = id;
	}
	
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getIdconv() {
		return this.idconv;
	}

	public void setIdconv(int idconv) {
		this.idconv = idconv;
	}

	public Date getSendTime() {
		return this.sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	public Conversation getConversation() {
		return this.conversation;
	}

	public void setConversation(Conversation conversation) {
		this.conversation = conversation;
	}
	
}